<?php
//require_once 'PEAR.php';
require_once 'Text/Diff.php';
require_once 'Text/Diff/Renderer/unified.php';

class Sabai_Template_Default_Helper_TextDiff extends Sabai_Template_Default_Helper
{
    function execute($from, $to, $engine = 'auto')
    {
        $from = !is_array($from) ? explode("\n", $from) : $from;
        $to = !is_array($to) ? explode("\n", $to) : $to;
        $renderer =& new Text_Diff_Renderer_unified();
        return $renderer->render(new Text_Diff($engine, array($from, $to)));
    }
}